<template>
  <div>
    <div class="item" @click.stop="toCompanyDetailHandler(item._id)">
      <div class="item-left">
        <img :src="item.logoUrl" alt="" />
      </div>
      <div class="item-right">
        <div class="title">{{ item.title }}</div>
        <div class="des">
          {{ item?.address?.slice(0, 2) }} | {{ item.companyType }} |
          {{ item.companyNumber }}
        </div>
        <div class="item-foo">
          <div>
            热招:<span
              class="color"
              v-for="work in item?.workInfo?.slice(0, 1)"
              :key="work._id"
              >{{ work.title }}</span
            >等{{ Math.floor(Math.random() * 66) }}个岗位
          </div>
          <div class="icont">
            <img src="@/../public/images/1668390326704.png" alt="" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CompanyComponent",
  props: {
    item: {
      type: Object,
      default: () => ({}),
    },
  },
  methods: {
    //跳转到公司详情
    toCompanyDetailHandler(id) {
      this.$router.push(`/companydetail?id=${id}`);
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  text-align: start;
  display: flex;
  width: 6.9rem;
  background: #ffffff;
  box-shadow: 0px 0.06rem 0.21rem 0px rgba(20, 150, 57, 0.22);
  border-radius: 0.2rem;
  margin: 0.3rem auto;
  box-sizing: border-box;
  padding: 0.39rem 0.27rem 0.3rem 0.32rem;
  .item-left {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 0.19rem;
  }
  .item-right {
    flex-grow: 1;
    > div {
      margin-bottom: 0.15rem;
      &:last-child {
        margin-bottom: 0;
      }
    }
    .title {
      font-size: 0.36rem;
      font-weight: 400;
      color: #333333;
    }
    .des {
      font-size: 0.2rem;
      font-weight: 300;
      color: #333333;
    }
    .ir-list {
      display: flex;
      flex-wrap: wrap;
      > div {
        height: 0.36rem;
        background: #f4f4f4;
        border-radius: 0.08rem;
        margin-right: 0.1rem;
        box-sizing: border-box;
        padding: 0 0.04rem 0 0.04rem;
        font-size: 0.2rem;
        font-weight: 300;
        color: #333333;
        line-height: 0.36rem;
      }
    }
    .item-foo {
      width: 100%;
      height: 0.85rem;
      font-size: 0.24rem;
      font-weight: 400;
      color: #333333;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .color {
        color: #149639;
        margin: 0 0.06rem;
      }
      .icont {
        width: 0.15rem;
        height: 0.28rem;
      }
    }
  }
}
</style>